package view;

import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.paint.Color;
import javafx.stage.StageStyle;

import java.io.IOException;

public class SearchFriendOrGroupView extends Window {

    private OnLineView onLineView;

    public SearchFriendOrGroupView(OnLineView onLineView) throws IOException {
        root = FXMLLoader.load(getClass().getClassLoader().getResource("searchFriend.fxml"));
        Scene scene = new Scene(root, 600, 300);
        scene.setFill(Color.TRANSPARENT);
        setScene(scene);
        initStyle(StageStyle.TRANSPARENT);
        setResizable(false);
        setTitle("Search");
        move();
        quit();
        minimize();

        this.onLineView = onLineView;

        init();
    }

    private void init() {
        ((Button)findViewById("sf")).setStyle("-fx-text-fill: #5a94ff");
    }

    @Override
    public void quit() {
        ((Button)findViewById("quit")).setOnAction(event -> {
            close();
        });
    }

    @Override
    public void minimize() {
        ((Button)findViewById("min")).setOnAction(event -> {
            setIconified(true);
        });
    }

    public OnLineView getOnLineView() {
        return onLineView;
    }
}
